package com.freesky.biz.activity.mapper;

import com.freesky.biz.activity.domain.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface AlipayBillTaskMapper {

    List<TAlipayBill> selectBillList(TAlipayBill entity);
    List<TAlipayRefundBill> selectRefundBillList(TAlipayRefundBill entity);
    List<TAlipayBillSummary> selectBillSummaryList(TAlipayBill entity);

    TAlipayActivityConfigExport selectBillSummaryData(TAlipayBill entity);
    TAlipayActivityConfigExport selectRefundBillSummaryData(TAlipayRefundBill entity);

    /**
     * 取账单列表
     */
    List<TAlipayBillTask> selectBillTaskList(TAlipayBillTask alipayBillTask);

    /**
     * 取最新一条(账单日期）
     */
    TAlipayBillTask selectLatestBillTask();

    /**
     *  根据时间取
     */
    int selectBillTaskByDay(@Param("billDay") String billDay);

    /**
     *
     * @return
     */
    int addBillTask(TAlipayBillTask alipayBillTask);

    /**
     * 更新账单周期
     * @param alipayBillTask
     * @return
     */
    int updateBillTask(TAlipayBillTask alipayBillTask);

    int addBillBatchOrUpdate(@Param("alipayBills") List<TAlipayBill> alipayBillList);
    int addRefundBillBatchOrUpdate(@Param("alipayRefundBills") List<TAlipayRefundBill> alipayRefundBillList);

    /**
     * 生成每天统计的报表
     * @return
     */
    public String selectMaxBillUpdateDate();
    public String selectMinBillConsumeTime(@Param("updateDate") String updateDate);
    public int addBillReportDay(@Param("startDt") String startDt,
                                @Param("endDt") String endDt);

    public String selectMaxRefundBillUpdateDate();
    public String selectMinBillRefundTime(@Param("updateDate") String updateDate);
    public int addRefundBillReportDay(@Param("startDt") String startDt,
                                @Param("endDt") String endDt);

    //增量更新活动表
    public int addAlipayActivityConfig(@Param("startDt") String startDt,
                                      @Param("endDt") String endDt);

    public int addAlipayRefundActivityConfig(@Param("startDt") String startDt,
                                             @Param("endDt") String endDt);

    //更新活动订单金额
    public int updateAlipayConfigReport();

    /**
     * 更新核销状态
     * @return
     */
    public int updateConsumeStatus();

    /**
     * 更新中石化核销状态
     * @return
     */
    public int updateSinopecConsumeStatus();
}
